package com.ch.chatbot.interfaces.controller;

import cn.hutool.http.server.HttpServerRequest;
import com.ch.chatbot.domain.service.OpenAIService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@RestController
public class OpenAiController {

    @Autowired
    private OpenAIService openAIService;

    @PostMapping("/doChatGpt1")
    public String doChatGpt1(String question, String type) throws IOException {
        return openAIService.doChatGpt1(question, type);
    }

    @PostMapping("/sessionChat")
    public String sessionChat(String question, String userName) {
        return openAIService.sessionChat(question, userName);
    }

    @PostMapping("/doChatGpt2")
    public String doChatGpt2(String question) throws IOException {
        return openAIService.doChatGpt2(question);
    }

}
